/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package grest.controller;

import grest.model.Entidad;
import grest.model.Pedido;
import grest.model.TableModelABM;
import grest.model.ViewGeneral;
import grest.view.FormMozos;
import java.util.List;
import javax.swing.JTable;

/**
 *
 * @author santiago
 */
public class TablaMozosEventHandler {
    private FormMozos form;
    private JTable tablaMesas;
    private JTable tablaPedidos;
    private TableModelABM newModel = null;
    
    public TablaMozosEventHandler(FormMozos form){
        this.form = form;
        this.tablaMesas = (JTable) form.getControls("tblMesas");
        this.tablaPedidos = (JTable) form.getControls("tblPedidos");       
    }
    public void setVistaContextual(){
        Integer fila = this.tablaMesas.getSelectedRow();
        List<Entidad> arrayV =  ((TableModelABM) this.tablaMesas.getModel()).getModel();
        Integer nroMov = ((ViewGeneral)arrayV.get(fila)).getNroMov();
        newModel = new TableModelABM(new Pedido(nroMov));
        this.tablaPedidos.setModel(newModel);
    }
}
